﻿using BaiTu.TestIng.Domain;
using ServiceStack.Messaging;
using ServiceStack.Messaging.Redis;
using ServiceStack.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiTu.ServiceStack.Sub
{
    class Program
    {
        static void Main(string[] args)
        {
            var redisFactory = new PooledRedisClientManager("192.168.1.104:6379");

            RedisMessageFactory factory = new RedisMessageFactory(redisFactory);
            IMessageProducer producer = factory.CreateMessageProducer();

            var iclient = factory.CreateMessageQueueClient();

          
            //var mqServer = new RedisMqServer(redisFactory, retryCount: 2);

            //mqServer.RegisterHandler<HelloResponse>(m =>
            //{
            //    Console.WriteLine("Received:" + m.GetBody().Result);
            //    return null;
            //});

            //mqServer.Start();

            //var mqClient = mqServer.CreateMessageQueueClient();
            //for (int i = 0; i <= 1000; i++)
            //{
            //    mqClient.Publish(new Hello() { Name = i.ToString() + "Client1" });



            //    FF.WriteLog(1,i.ToString()+"client");
            //}
            Console.WriteLine("Client running");
            Console.ReadLine();
        }
    }
}
